var myChart = echarts.init(document.getElementById('energyConsumptionChart'));
function devEnergy(data){
	return  {
        title:{
            text:"各设备能耗情况",
            textStyle:{
                color:'#33FFFF',
            },
            left:'center',
            top:'15px'
        },
        grid:{
            left:'200'
        },
        xAxis:[{

            type:'value',
            splitLine:{
                show:false
            },
            axisLabel: {
                formatter: '{value}',
                textStyle: {
                    color: '#fff',
                    fontWeight: '80'
                }
            }
        }],
        yAxis:[{
            type:'category',
            axisLabel: {
                color: '#fff',
                fontSize: 14
            },
            splitLine:{
                show:false
            },
            data:data.ydata
        }],
        series:[{
            type:'bar',
            barWidth: 12,
            itemStyle: {
                normal: {
                    // barBorderRadius: 20, //统计条弧度
                    color: {

                        colorStops: [{
                            offset: 0,
                            color: '#00b0ff' // 0% 处的颜色
                        }, {
                            offset: 1,
                            color: '#7052f4' // 100% 处的颜色
                        }],
                        globalCoord: false, // 缺省为 false

                    }
                },
            },

            label: {

                normal: {
                    show: true,
                    position:'right',
                    formatter: function(v) {
                        var num = v.data;
                        var result = [ ], counter = 0;
                        num = (num || 0).toString().split('');
                        for (var i = num.length - 1; i >= 0; i--) {
                            counter++;
                            result.unshift(num[i]);
                            if (!(counter % 3) && i != 0) { result.unshift(','); }
                        }
                        return result.join('');
                    },
                    color: '#fff'
                }
            },
            data:data.xdata
        }],

    }
}


/* $(function(){
	var sum = 0;
	var arr = '6,8,10,10,12,18,21,22,23,25,26,28,30,30,31,32,33,34,37';
	var a = arr.split(",");
	for(var i =0;i<a.length;i++){
		sum += parseInt(a[i]);
	}
	console.log(sum);
}) */
